import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: shy
 * @Date: 2021/04/29/19:06
 * @Description:
 */
class Solution {
    public static int singleNumber(int[] nums) {
        int[] bitarr = new int[32];
        for(int num : nums){
            for(int i = 0; i < 32; i++){
                bitarr[i] += num & 1;
                num >>= 1;
            }
        }
        int ans = 0, m = 3;
        for(int i = 0; i < 32; i++){
            ans <<= 1;
            ans |= bitarr[31 - i] % m;
        }
        return ans;
    }

    public static void main(String[] args) {
        int[] a = {2,2,2,3};
        System.out.println(singleNumber(a));;
    }
}
